using System;
using System.Collections;
using System.ComponentModel;
using PickGold.Charting.ChartTypes;

namespace PickGold.Charting
{
	internal class ChartTypeConverter : StringConverter
	{
		public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
		{
			ChartTypeRegistry service = null;
			ArrayList values = new ArrayList();
			Chart chartFromContext = ConverterHelper.GetChartFromContext(context);
			if (chartFromContext != null)
			{
				service = (ChartTypeRegistry)chartFromContext.GetService(typeof(ChartTypeRegistry));
				if (service == null)
				{
					throw new InvalidOperationException(SR.ExceptionEditorChartTypeRegistryServiceInaccessible);
				}
				foreach (object obj2 in service.registeredChartTypes.Keys)
				{
					if (obj2 is string)
					{
						values.Add(obj2);
					}
				}
			}
			values.Sort();
			return new TypeConverter.StandardValuesCollection(values);
		}

		public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
		{
			return true;
		}

		public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
		{
			return true;
		}
	}
}

